How I can count values and obtain another array structure

join shbcf.ru